<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" ></script>
<script type="text/javascript">

	var center;
	var map;

	var image = 'spo.png';
	var staicon = 'sta.png';
  function initialize(center,stations) {
 
    var gpscenter = eval(center);
	if(gpscenter[0].latitude > 0.0 && gpscenter[0].longitude > 0.0)
  		center = new google.maps.LatLng(gpscenter[0].latitude, gpscenter[0].longitude);
  	else
  		center = new google.maps.LatLng(24.486000, 118.140000);
    var myOptions = {
      zoom: 15,
      center: center,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
    google.maps.event.addListener(map, 'mouseup', function(event) {
    	javascript:doudou.refreshAfterFiling(event.latLng.lat(), event.latLng.lng());
	 });

	/*   Remove the anchor since it is somewhat annoying.
	var marker = new google.maps.Marker({
	      position: center, 
	      map: map, 
	      icon: image,
	   	  title:"Hello World!"
	  	 }); 

		 google.maps.event.addListener(marker, 'click', function() {
	  		javascript:doudou.callbackFromjs();
		 });
		 */
	var stas = eval(stations);
	
	
	if(stas.length>0){
		for(var i=0; i<stas.length; i++){
			var sta = stas[i];

			if(sta.latitude >0.0 && sta.longitude > 0.0){
				var nearbystation = new google.maps.LatLng(sta.latitude, sta.longitude);
				var marker = new google.maps.Marker({
			     	position: nearbystation, 
			      	map: map, 
			      	icon: staicon,
			      	title:"bus station"
		  		});
		  		addClickEvent(marker , i);
			}
		}
	 }
}
  
function addClickEvent(marker, number) {
 google.maps.event.addListener(marker, 'click', function() {
      javascript:doudou.showStationInfo(number);
  });
}
</script>
</head>
<body onload="javascript:doudou.showOverlay()" style="padding:0px; margin:0px">
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>